package service;

import java.util.*;

import beans.*;
import db.*;

public class UserService {
	/*public List<AdminBean> browse(){
		UserDAO dao =new UserDAO();
		return dao.Admin_getAllRecords();
	}*/
	
	/*public boolean addUser(UserBean user)
	{
		UserDAO userDao=new UserDAO();
		return userDao.insertRecord(user);
	}*/
	
	public int AdminReturn(CarRequestBean user)
	{
		UserDAO userDao=new UserDAO();
		if(userDao.AdminReturn(user))
			return 1;
		else
			return 2;

	}
	
	public List<Driver_TaskBean> Driver_Task_browse(){
		UserDAO dao =new UserDAO();
		return dao.getDriver_Task_AllRecords();
	}
	
	public List<CarRequestBean> CarRequestBean_browse(){
		UserDAO dao =new UserDAO();
		return dao.getCarRequest_AllRecords();
	}
	
	public CarRequestBean getCarRequest_getRecord(String RequestID){
		UserDAO dao =new UserDAO();
		return dao.getCarRequest_getRecord(RequestID);
	}
	
	public AdminBean getAdmin_getRecord(String ID){
		UserDAO dao =new UserDAO();
		return dao.getAdmin_getRecord(ID);
	}
	
	public boolean staff_addInfo(EmployeeCarInfoBean user)
	{
		UserDAO userDao=new UserDAO();
		return userDao.staff_insertInfo(user);
	}
	
	public boolean staff_addCarRequest(CarRequestBean user)
	{
		UserDAO userDao=new UserDAO();
		return userDao.staff_insertCarRequest(user);
	}
	
	public boolean login(String ID,String password,String department)
	{
		UserDAO userDao=new UserDAO();
		return userDao.login_valid(ID, password,department);
	}
	
	public boolean enroll_valid(String EmpID)
	{
		UserDAO userDao=new UserDAO();
		return userDao.enroll_valid(EmpID);
	}
	
	public int enroll_edit(EmployeeBean Record)
	{
		UserDAO userDao=new UserDAO();		
		if(userDao.enroll_update(Record))
			return 1;
		else
			return 0;
	}
	
	public int AdminSubmit_edit(CarRequestBean Record)
	{
		UserDAO userDao=new UserDAO();		
		if(userDao.AdminSubmit_edit(Record))
			return 1;
		else
			return 0;
	}
	
	public String getLastRequestID()
	{
		UserDAO userDao=new UserDAO();
		return userDao.getLastRequestID();
	}
}
